import { ColumnGroupType, ColumnType } from "antd/es/table"

import { IResponseItemDetail } from "@/api/funds/agentTopupReviewRecord/types"

const AgentTopupReviewColumn = (
	newFormat: (arg: string) => string,
	getFromDic: (arg: string, strictlyLabel?: boolean) => any,
	getLabel: (value: string | number, modal: string, strictlyLabel?: boolean, customDictArr?: any[]) => any
): Record<string, ColumnGroupType<any> | ColumnType<any>> => ({
	agentDetail_createDt: {
		title: newFormat("funds.fund_audit.register_time"),
		dataIndex: "createDt",
		key: "createDt",
		align: "center",
		width: 160,
		render: (text: string) => text || "-"
	},

	agentDetail_lastLoginTime: {
		title: newFormat("funds.fund_audit.last_login_datetime"),
		dataIndex: "lastLoginTime",
		key: "lastLoginTime",
		align: "center",
		width: 160,
		render: (text: string) => text || "-"
	},

	agentDetail_lastBetTime: {
		title: newFormat("funds.fund_audit.last_bet_time"),
		dataIndex: "lastBetTime",
		key: "lastBetTime",
		align: "center",
		width: 160,
		render: (text: string) => text || "-"
	},

	agentDetail_deviceType: {
		title: newFormat("funds.fund_audit.registry_app_type"),
		dataIndex: "deviceType",
		key: "deviceType",
		align: "center",
		width: 100,
		render: getFromDic("deviceType", false)
	},

	agentDetail_registerIp: {
		title: newFormat("funds.fund_audit.register_ip"),
		dataIndex: "registerIp",
		key: "registerIp",
		align: "center",
		width: 130,
		render: (text: string) => text || "-"
	},

	agentDetail_ipAttribution: {
		title: newFormat("funds.fund_audit.ip_attribution"),
		dataIndex: "ipAttribution",
		key: "ipAttribution",
		align: "center",
		width: 150,
		render: (text: string) => text || "-"
	},

	agentDetail_parentProxyName: {
		title: newFormat("funds.fund_audit.parent_proxy_account"),
		dataIndex: "parentProxyName",
		key: "parentProxyName",
		align: "center",
		width: 120,
		render: (text: string) => text || "-"
	},
	//table 2
	agentDetail_userName: {
		title: newFormat("funds.proxy_name"),
		dataIndex: "userName",
		key: "userName",
		align: "center",
		render: (text: string) => text || "-"
	},

	agentDetail_loginLockStatus: {
		title: newFormat("common.account_status"),
		dataIndex: "loginLockStatus",
		key: "loginLockStatus",
		align: "center",
		render: (status: number, record: IResponseItemDetail) => {
			if (status === 1) {
				return <span className="disableRgba">{newFormat("common.login_lock_status")}</span>
			}
			if (record.paymentLockStatus === 1) {
				return <span className="deleteRgba">{newFormat("common.account_lock_status")}</span>
			}
			if (status === 0 && record.paymentLockStatus === 0) {
				return <span className="normalRgba">{newFormat("common.account_status_normal")}</span>
			}
		}
	},
	agentDetail_labelName: {
		title: newFormat("funds.fund_audit.proxy_label_name"),
		dataIndex: "labelName",
		key: "labelName",
		align: "center",
		render: (text: string) => text || "-"
	},
	//table 3
	agentDetail_operator: {
		title: newFormat("funds.fund_audit.operator"),
		dataIndex: "operator",
		key: "operator",
		align: "center",
		render: (text: string) => text || "-"
	},
	agentDetail_eventTime: {
		title: newFormat("funds.apply_time"),
		dataIndex: "eventTime",
		key: "eventTime",
		align: "center",
		render: (text: string) => text || "-"
	},
	agentDetail_operatorRemark: {
		title: newFormat("funds.fund_audit.operator_remark"),
		dataIndex: "operatorRemark",
		key: "operatorRemark",
		align: "center",
		ellipsis: true,
		render: (text: string) => text || "-"
	},
	// table 4
	agentDetail_adjustType: {
		title: newFormat("funds.fund_audit.adjust_type"),
		dataIndex: "adjustType",
		key: "adjustType",
		align: "center",
		render: (text: number) => {
			return <>{text || text === 0 ? getLabel(text, "proxyPatchAddAdjustType", false) : "-"}</>
		}
	}
})

export default AgentTopupReviewColumn
